home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / editor / frexxed / fpl / simplehelp.fpl < prev    next >
Text File  |  1996-02-17  |  2KB  |  54 lines

  1. export void SimpleHelp(string doc)
  2. {
  3.   string docfile="Guide:AllNodes";
  4.   int oldbuffer=GetEntryID();
  5.   int buffer;
  6.   string line, file;
  7.   int start=6, stop;
  8.   int found=0;
  9.  
  10.   if (strlen(doc)) {
  11.     buffer=New();
  12.     if (buffer) {
  13.       found=1;
  14.       Visible(0);
  15.       CurrentBuffer(buffer);
  16.       Clean(joinstr("Load(\"", docfile, "\");"));
  17.       GotoLine(1, 0);
  18.       if (Search(joinstr("\"", doc, "\""), "fc+ow-")<0) {
  19.         if (Search(joinstr(" ", doc, " "), "fc+ow-")<0) {
  20.           if (Search(doc, "fco+w-")<0) {
  21.             found=0;
  22.           }
  23.         }
  24.       }
  25.       if (found) {
  26.         found=0;
  27.         line=GetLine();
  28.         if (line[start]=='\"')
  29.           stop=strstr(line, "\"", ++start);
  30.         else {
  31.           stop=strstr(line, " ", start);
  32.           if (stop==-1)
  33.             stop=strstr(line, "\n", start);
  34.         }
  35.         if (stop) {
  36.           line=substr(line, start, stop-start);
  37.           if (Search(":\n", "fow-")>=0) {
  38.             file=substr(GetLine(), 0, ReadInfo("byte_position"));
  39.             System(sprintf("run >nil: <nil: Amigaguide \"%s\" Document \"%s\" PubScreen \"%s\"", file, line, ReadInfo("current_screen", oldbuffer)));
  40.             ReturnStatus(sprintf("AMIGAGUIDE \"%s\" DOCUMENT \"%s\" PUBSCREEN \"%s\"", file, line, ReadInfo("current_screen", oldbuffer)));
  41.             found=1;
  42.           }
  43.         }
  44.       }
  45.       CurrentBuffer(oldbuffer);
  46.       Kill(buffer);
  47.     }
  48.   }
  49.   if (!found)
  50.     System(sprintf("run >nil: <nil: Amigaguide FrexxEd:Docs/FrexxEd.guide PubScreen \"%s\"", ReadInfo("current_screen")));
  51. }
  52. AssignKey("SimpleHelp(PromptString(\"\", \"Help on word\"));", "Amiga Shift 'Help'");
  53. AssignKey("SimpleHelp(GetWord());", "'Help'");
  54.